<template>
  <div class="wrap">
    <el-popover placement="top" width="180" trigger="manual" v-model="visible">
      <p>是否重置密码？</p>
      <div style="text-align: right; margin: 0">
        <el-button size="mini" type="text" @click="visible = false"
          >取消</el-button
        >
        <el-button type="primary" size="mini" @click="resetpassword"
          >确定</el-button
        >
      </div>
      <el-button
        slot="reference"
        type="primary"
        icon="el-icon-question"
        size="mini"
        class="uuubox"
        @click="visible = true"
      />
    </el-popover>
  </div>
</template>
<script>
import { resetPass } from "@/api/system/user";
export default {
  data() {
    return {
      visible: false,
    };
  },
  props: {
    data: {
      type: Object,
      required: true,
    },
  },
  methods: {
    resetpassword() {
      this.visible = false;
      resetPass(this.data.id)
        .then(() => {
          this.$notify({
          title: '成功',
          message: '默认密码为HNpgc_3!',
          type: 'success'
        });
        })
        .catch(() => {
               this.$notify.error({
          title: '错误',
          message: '重置密码报错'
        });
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.uuubox {
  float: left;
  margin-right: 5px;
}
</style>